package tests;


import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import business.Disciplina;
import business.Oferta;
import business.Oferta.Semestre;
import business.Perfil;

public class OfertaTest {

	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
	}

	@AfterClass
	public static void tearDownAfterClass() throws Exception {
	}

	@Before
	public void setUp() throws Exception {
	}

	@After
	public void tearDown() throws Exception {
	}
	
	@Test
	public void validConstruct(){
		Oferta o = new Oferta(new Disciplina(), new Perfil(), 3, Semestre.par, 2, true);
	}
	
//	@Test
//	public void invalidConstruct(){
//		Oferta o = new Oferta(null, null, -1, null, -1, false);
//	}
	
	@Test
	public void validSetDisciplina(){
		Oferta o = new Oferta();
		o.setDisciplina(new Disciplina());
	}
	
	@Test (expected=AssertionError.class)
	public void invalidSetDisciplina(){
		Oferta o = new Oferta();
		o.setDisciplina(null);
	}
	
	@Test
	public void validSetPerfil(){
		Oferta o = new Oferta();
		o.setPerfil(new Perfil());
	}
	
	@Test (expected=AssertionError.class)
	public void invalidSetPerfil(){
		Oferta o = new Oferta();
		o.setPerfil(null);
	}
	
	@Test
	public void validSetECTS(){
		Oferta o = new Oferta();
		o.setEcts(55);
	}
	
	@Test (expected=AssertionError.class)
	public void invalidSetECTS(){
		Oferta o = new Oferta();
		o.setEcts(-3);
	}
	
	@Test
	public void validSetSemestre(){
		Oferta o = new Oferta();
		o.setSemestre(Semestre.impar);
	}
	
	@Test (expected=AssertionError.class)
	public void invalidSetSemestre(){
		Oferta o = new Oferta();
		o.setSemestre(null);
	}
	
	@Test
	public void validSetAno(){
		Oferta o = new Oferta();
		o.setAno(3);
	}
	
	@Test (expected=AssertionError.class)
	public void invalidSetAno(){
		Oferta o = new Oferta();
		o.setAno(-33);
	}
	
	@Test
	public void validSetObrigatoria(){
		Oferta o = new Oferta();
		o.setObrigatoria(false);
	}
	
	@Test
	public void validSetVagas(){
		Oferta o = new Oferta();
		o.setVagas(0);
	}
	
	@Test (expected=AssertionError.class)
	public void invalidSetVagas(){
		Oferta o = new Oferta();
		o.setVagas(-5);
	}
	
	@Test
	public void objectTester(){
		Oferta.objectos();
	}
	
	@Test
	public void resetTester(){
		Oferta.reset();
	}
	
	@Test
	public void getterTester(){
		Oferta o = new Oferta();
		o.getAno();
		o.getClass();
		o.getDisciplina();
		o.getEcts();
		o.getPerfil();
		o.getSemestre();
		o.getVagas();
	}
	
	@Test
	public void isObrigatoriaTester(){
		Oferta o = new Oferta();
		o.isObrigatoria();
	}
	
	@Test
	public void toStringTester(){
		Oferta o = new Oferta();
		o.setAno(1990);
		o.setDisciplina(new Disciplina());
		o.setEcts(3);
		o.setObrigatoria(true);
		o.setPerfil(new Perfil());
		o.setSemestre(Semestre.impar);
		o.setVagas(3);
		o.toString();
	}
	

}
